package nyist.media.entity;

import lombok.Data;
import nyist.media.entity.admin.Admin;
import nyist.media.enums.RepairStatus;

import javax.persistence.*;
import java.util.Date;

/**
 * 维修单
 *
 * @author : dcf
 * @date : 2019/3/11
 */

@Data
@Entity
@Table(name = "m_p_repair")
public class RepairRecord extends BaseEntity {

    /** 需要维修的教室*/
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "room_id", columnDefinition = "bigint(11) COMMENT '教室id'")
    private ClassRoom room;

    /**
     * 提交人
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "commeit_admin_id", columnDefinition = "bigint(11) COMMENT '提交维修记录的管理员ID'")
    private Admin commitAdmin;

    /**
     * 问题描述
     */
    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Column(columnDefinition = "text COMMENT '问题描述'")
    private String text;

    /**
     * 维修单状态
     */
    @Column(columnDefinition = "int(11) COMMENT '0: 待维修 1：已维修 2：驳回'")
    private RepairStatus status;

    /**
     * 驳回理由
     */
    @Column(columnDefinition = "varchar(255) COMMENT '驳回原因'")
    private String rejectedReason;

    /**
     * 维修时间
     */
    @Column(columnDefinition = "datetime COMMENT '维修时间'")
    private Date repairDate;

    /**
     * 维修完成时间
     */
    @Column(columnDefinition = "datetime COMMENT '提交时间'")
    private Date commitDate;

    /**
     * 维修人信息
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "repair_admin_id", columnDefinition = "bigint(11) COMMENT '维修员的ID'")
    private Admin repairAdmin;
}